From: Brion Vibber Date: Sat, 9 Aug 2003 10:08:23 +0000 (+0000) Subject: Alternate db connect, use proper charset in abort page X-Git-Tag: 1.1.0~353 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=1b8437287753dd16a8ed65d27f8c2c7207ad69c5;p=lhc%2Fweb%2Fwiklou.git Alternate db connect, use proper charset in abort page --- diff --git a/includes/DatabaseFunctions.php b/includes/DatabaseFunctions.php index 191a763237..dac342ccce 100644 --- a/includes/DatabaseFunctions.php +++ b/includes/DatabaseFunctions.php @@ -5,7 +5,7 @@ include_once( "$IP/CacheManager.php" ); $wgLastDatabaseQuery = ""; -function wfGetDB( $altuser = "", $altpassword = "" ) +function wfGetDB( $altuser = "", $altpassword = "", $altserver = "", $altdb = "" ) { global $wgDBserver, $wgDBuser, $wgDBpassword; global $wgDBname, $wgDBconnection, $wgEmergencyContact; @@ -18,7 +18,9 @@ function wfGetDB( $altuser = "", $altpassword = "" ) $wgEmergencyContact . "\">Wikipedia developers.

"; if ( $altuser != "" ) { - $wgDBconnection = mysql_connect( $wgDBserver, $altuser, $altpassword ) + $serve = ($altserver ? $altserver : $wgDBserver ); + $db = ($altdb ? $altdb : $wgDBname ); + $wgDBconnection = mysql_connect( $serve, $altuser, $altpassword ) or die( "bad sql user" ); mysql_select_db( $wgDBname, $wgDBconnection ) or die( htmlspecialchars(mysql_error()) ); @@ -35,7 +37,7 @@ function wfGetDB( $altuser = "", $altpassword = "" ) @$wgDBconnection = mysql_connect( $wgDBserver, $wgDBuser, $wgDBpassword ) or wfEmergencyAbort(); - @mysql_select_db( $wgDBname, $wgDBconnection ) + @mysql_select_db( $db, $wgDBconnection ) or wfEmergencyAbort(); } } @@ -46,8 +48,9 @@ function wfGetDB( $altuser = "", $altpassword = "" ) /* Call this function if we couldn't contact the database... We'll try to use the cache to display something in the meantime */ function wfEmergencyAbort( $msg = "" ) { - global $wgTitle, $wgUseFileCache, $title; + global $wgTitle, $wgUseFileCache, $title, $wgOutputEncoding; + header( "Content-type: text/html; charset=$wgOutputEncoding" ); if($msg == "") $msg = wfMsg( "noconnect" ); $text = $msg;